<?php include '../includes/verificasession.php';
 if( $_SESSION['NV_ACESSO_USUARIO'] >= 99 )
{?>
<?php
//Chamada da Função de Conexão com o BD.
include "../includes/config_conexao.php";
//Inicio da Função de Alteração do Cadastro de Usuário.
$ID_PECA = $_POST['id'];
$sql_update = mysql_query ("SELECT * FROM `peca` WHERE (`ID_PECA`='$ID_PECA')");
while ( $linha = mysql_fetch_array ($sql_update))
	{
	$ID_PECA				= $linha['ID_PECA'];
	$ID_FORNECEDOR			= $linha['ID_FORNECEDOR'];
	$ID_CATEGORIA			= $linha['ID_CATEGORIA'];
	$DESC_PECA				= $linha['DESC_PECA'];
	$VLR_NORMAL				= $linha['VLR_NORMAL'];
	$VLR_DESCONTO			= $linha['VLR_DESCONTO'];
	$GARANTIA				= $linha['GARANTIA'];
	$QTDESTOQUE				= $linha['QTDESTOQUE'];
	$STATUS_PECA			= $linha['STATUS_PECA'];
	$DATA_INC_PECA			= $linha['DATA_INC_PECA'];
	}
?>
<!--Inicio da Tabela de Cadastro de Cliente -->
<div style="width:100%" id="pcadastro">
	<h1>Atualização de Cadastro de Peças</h1>
    <span class="style2">*</span> Campos Obrigatórios.
    <form id="cadastro" name="cadastro" method="post" action="funcao.php?acao=alterar&ID_PECA=<?php echo $ID_PECA; ?>" onsubmit="return validaCampo(); return false;">
  	<table width="650" border="0">
	<tr>
    <td width="">Fornecedor:</td>
    <td><select name="ID_FORNECEDOR" id="ID_FORNECEDOR">
    	<option></option>
		<?php include 'fornecedor.php' ?>
  		</select>
    <span class="style1"> *</span></td>
    </tr>
	<tr>
    <td width="">Categoria:</td>
    <td><select name="ID_CATEGORIA" id="ID_CATEGORIA">
    	<option></option>
		<?php include 'categoria.php' ?>
  		</select>
    <span class="style1"> *</span></td>
    </tr>
    <tr>
      <td width="">Descrição da Peça:</td>
      <td width=""><input value="<?php echo $DESC_PECA; ?>"  name="DESC_PECA" type="text" id="DESC_PECA" size="35" maxlength="100" />
      <span class="style1">*</span></td>
    </tr>
    <tr>
      <td width="">Valor</td>
      <td width=""><input value="<?php echo $VLR_NORMAL; ?>"  name="VLR_NORMAL" type="text" id="VLR_NORMAL" size="15" maxlength="10" />
      <span class="style1">*</span></td>
    </tr>
    <tr>
      <td width="">Valor com Desconto</td>
      <td width=""><input value="<?php echo $VLR_DESCONTO; ?>"  name="VLR_DESCONTO" type="text" id="VLR_DESCONTO" size="15" maxlength="10" />
      <span class="style1">*</span></td>
    </tr>
    <tr>
      <td width="">Garantia</td>
      <td width=""><input value="<?php echo $GARANTIA; ?>"  name="GARANTIA" type="text" id="GARANTIA" size="10" maxlength="4" />
      <span class="style1">*</span></td>
    </tr>
    <tr>
      <td width="">Quantidade</td>
      <td width=""><input value="<?php echo $QTDESTOQUE; ?>"  name="QTDESTOQUE" type="text" id="QTDESTOQUE" size="10" maxlength="4" />
      <span class="style1">*</span></td>
    </tr>
    <tr>
    <td colspan="2">
        <input class="btn" name="cadastrar" type="submit" id="cadastrar" value="Salvar" /> 
		<input type="button" class="btn" value="Fechar" onclick='fechaModal()'/>
	</td>
    </tr>
  </table>
</form>
<?php 
} else
{
echo "
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=../uf/cadastro.php'>
<script type=\"text/javascript\">
alert(\"Página restrita, entre em contato com o Administrador!\");
</script>
";
exit;
}
?>
